@extends("admin.common.admin")
<title>权限管理</title>
@section("cnt")
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i>
        首页
        <span class="c-gray en">&gt;</span>
        权限管理
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <div class="page-container">
        @include("admin.common.msg")
        <form action="{{ route("admin.admin.user") }}" method="get">
            <div class="text-c"> 日期范围：
                <input type="text" value="{{ request()->get("datemax") }}" name="datemax" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin" class="input-text Wdate" style="width:120px;">
                -
                <input type="text" value="{{ request()->get("datemin") }}" name="datemin" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax" class="input-text Wdate" style="width:120px;">
                <input type="text" value="{{ request()->get("username") }}" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱" id="" name="username">
                <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
            </div>
        </form>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            {!! $admin->addBtn("admin.node.create","添加权限") !!}
        </span>
            <span class="r">共有数据：
            <strong></strong> 条
        </span>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-hover table-bg table-sort">
                <thead>
                <tr class="text-c">
                    <th width="80">ID</th>
                    <th width="100">权限名称</th>
                    <th width="40">路由别名</th>
                    <th width="70">是否菜单</th>
                    <th width="130">加入时间</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr class="text-c">
                        <td>{{ $item["id"] }}</td>
                        <td>{{ $item["html"] }}{{ $item["node_name"] }}</td>
                        <td>{{ $item["route_name"] }}</td>
                        <td>{{ $item["created_at"] }}</td>
                        <td class="td-status">
                            @if($item["is_menu"] == "0")
                                <span class="label label-danger radius">否</span>
                            @else
                                <span class="label label-success radius">是</span>
                            @endif
                        </td>
                        <td class="td-manage">
                            {!! $admin->editBtn("admin.node.edit","修改",["id" => $item["id"]]) !!}
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
@endsection
@section("js")
    <script>

        $(function () {
            $(".del").click(function () {
                // let href = ;
                layer.confirm('确认删除该用户吗？', {
                    btn: ['确认','取消'] //按钮
                }, ()=>{
                    $.ajax({
                        url : $(this).attr("href"),
                        type : "delete",
                        data :{
                            _token:"{{ csrf_token() }}"
                        }
                    }).then(ret => {
                        // console.log(ret);
                        layer.msg(ret.msg, {icon: 1,time: 2000},()=>{
                            if(ret.status == 200){
                                $(this).parents("tr").remove();
                            }

                        });
                    });

                });


                return false;
            });
        })

    </script>
@endsection
